package domain;

import java.util.Date;
import java.util.Objects;

/**
 * 活动创建申请类
 *
 * @author liujiale
 */
public class ActivityApplication extends Application {

    /** 活动申请ID */
    private int activityApplicationID;

    /** 待处理的活动 */
    private Activity pendingActivity;

    /**
     * 构造函数
     *
     * @param activityApplicationID 活动创建申请ID
     * @param pendingActivity       待处理的活动
     */
    public ActivityApplication(int activityApplicationID, Activity pendingActivity) {
        this.activityApplicationID = activityApplicationID;
        this.pendingActivity = pendingActivity;
    }

    /**
     * 实现父类的构造函数
     *
     * @param applicationTime   申请时间
     * @param status            申请状态
     * @param description       描述
     * @param activityApplicationID 社团创建申请ID
     */
    public ActivityApplication(Date applicationTime, int status, String description, int activityApplicationID) {
        super(applicationTime, status, description);
        this.activityApplicationID = activityApplicationID;
    }

    /**
     * 实现父类的构造函数
     *
     * @param applicationTime       申请时间
     * @param applicant             申请人
     * @param status                申请状态
     * @param description           描述
     * @param activityApplicationID 活动创建申请ID
     * @param pendingActivity       待处理的活动
     */
    public ActivityApplication(Date applicationTime, StudentAccount applicant, int status, String description, int activityApplicationID, Activity pendingActivity) {
        super(applicationTime, applicant, status, description);
        this.activityApplicationID = activityApplicationID;
        this.pendingActivity = pendingActivity;
    }

    /**
     * Gets activity application id.
     *
     * @return the activity application id
     */
    public int getActivityApplicationID() {
        return activityApplicationID;
    }

    /**
     * Sets activity application id.
     *
     * @param activityApplicationID the activity application id
     */
    public void setActivityApplicationID(int activityApplicationID) {
        this.activityApplicationID = activityApplicationID;
    }

    /**
     * Gets pending activity.
     *
     * @return the pending activity
     */
    public Activity getPendingActivity() {
        return pendingActivity;
    }

    /**
     * Sets pending activity.
     *
     * @param pendingActivity the pending activity
     */
    public void setPendingActivity(Activity pendingActivity) {
        this.pendingActivity = pendingActivity;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (!(o instanceof ActivityApplication)) {
            return false;
        }
        if (!super.equals(o)) {
            return false;
        }
        ActivityApplication that = (ActivityApplication) o;
        return activityApplicationID == that.activityApplicationID && Objects.equals(pendingActivity, that.pendingActivity);
    }

    @Override
    public int hashCode() {
        return Objects.hash(super.hashCode(), activityApplicationID, pendingActivity);
    }

    @Override
    public String toString() {
        return "ActivityApplication{" +
                "activityApplicationID=" + activityApplicationID +
                ", pendingActivity=" + pendingActivity +
                '}';
    }
}
